<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  exclude-result-prefixes="">
  
  <xsl:param name="list"/>
  
	<xsl:variable name="snapshot" as="element()">
		<xsl:variable name="s" select="document(concat($list,'.view'))/snapshot"/>
		<snapshot>
			<xsl:copy-of select="$s/source"/>
			<xsl:copy-of select="$s/target"/>
			<xsl:for-each select="$s/resource">
				<resource>
					<xsl:copy-of select="@*"/>
					<xsl:if test="not(@out)">
						<xsl:attribute name="out">
							<xsl:value-of select="@ref"/>
						</xsl:attribute>
					</xsl:if>
				</resource>
			</xsl:for-each>
			<xsl:copy-of select="$s/replace"/>
		</snapshot>
	</xsl:variable>

</xsl:stylesheet>
